import requests

# 创建部门
create_org_url = 'https://qyapi.weixin.qq.com/cgi-bin/department/create'
params = {
    'access_token': 'i8ASIuPU7Eovm60s7QQ6_Awo1Gsf5q5Yla0uFCPetF2Ec1SNlRlgft4XQ3U9-p6-R1Sikq4IswWcWfDIJLiGFR3yxuSjJodWMVOqgXqZQJDR-8xhF9SDPWJUwjxj1aURtx6fPzmZiesKR0g05BEfW4QPPQXzdJ5zETAtHXqa9E1u1uKiOpAt-YlAJPmlRjS7fWnsMZSFKG128J8Uvhu04w'
}
json_data = {"name": "广州研发中心2","parentid": 1}
rep = requests.post(url=create_org_url, params=params, json=json_data)
print(rep.json())


# # 获取token
# id = "ww32f5df9a2517b554"
# secret = "nuNw29ZfaeuyYVhV1qrckKSn12Z7Lmntp3whCMbJF1w"
# url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'+"?corpid="+id+'&corpsecret='+secret
# print(url)
# token_rep = requests.get(url=url)
# print(token_rep.json().get('access_token'))
#
# token = 'i8ASIuPU7Eovm60s7QQ6_Awo1Gsf5q5Yla0uFCPetF2Ec1SNlRlgft4XQ3U9-p6-R1Sikq4IswWcWfDIJLiGFR3yxuSjJodWMVOqgXqZQJDR-8xhF9SDPWJUwjxj1aURtx6fPzmZiesKR0g05BEfW4QPPQXzdJ5zETAtHXqa9E1u1uKiOpAt-YlAJPmlRjS7fWnsMZSFKG128J8Uvhu04w'
# org_url = 'https://qyapi.weixin.qq.com/cgi-bin/user/list_id'
# params = {
#     'access_token': token
# }
# org_rep = requests.get(url=org_url, params=params)
# print(org_rep.json())


# # 请求百度
# url = 'https://www.baidu.com/'
# respons = requests.get(url=url)
# print(respons)
# print(respons.text)